package com.sxz.sbs.module.client.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.client.bean.CompactBean;
import com.sxz.sbs.module.client.view.CompactListView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;

/**
 * Created by tian on 2018/1/24 0024.
 */

public class CompactListPresenter extends RxPresenter<CompactListView>{
    /**
     * @param map
     */
    public void getCompactList (final HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getCompactList(map)
                .compose(RxUtil.<CompactBean>handleResult())
                .subscribeWith(new RxSubscriber<CompactBean>(mView){
                    @Override
                    public void onNext(CompactBean data) {
                        mView.onGetCompactListSuccess(data);
                    }
                })
        );
    }
}
